<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改付款计划')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-plan-edit" th:object="${payablePlan}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">计划名称：</label>
                <div class="col-sm-8">
                    <input name="planName" th:field="*{planName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">成本中心：</label>
                <div class="col-sm-8">
                    <select name="businessUnitDepartmentId"  class="form-control" th:field="*{businessUnitDepartmentId}" th:with="type=${@customDictService.selectDictBusinessUnitWithDepartments()}">
                        <option value="">--请选择--</option>
                        <optgroup th:each="unit: ${type}" th:label="${unit.name}">
                            <option th:each="department : ${unit.departments}" th:text="${department.name}" th:value="${department.id}" th:selected="${payablePlan.businessUnitDepartmentId == department.id}"></option>
                        </optgroup>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目：</label>
                <div class="col-sm-8">
                    <select name="projectId" th:field="*{projectId}" class="form-control" th:with="type=${@customDictService.selectDictAllProject()}">
                        <option value="">--请选择--</option>-->
                        <option th:each="project : ${type}" th:text="${project.title}" th:value="${project.id}"></option>-->
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">预计付款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="expectTime" th:value="${#dates.format(payablePlan.expectTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">预计付款金额：</label>
                <div class="col-sm-8">
                    <input name="expectAmount" th:field="*{expectAmount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">审批状态：</label>
                <div class="col-sm-8">
                    <select name="approveStatus" class="form-control" th:field="*{approveStatus}" th:with="type=${@dict.getType('payable_approve_status')}">
                        <option value="">请选择</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:selected="${dict.dictValue == 'free'}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">付款分类：</label>
                <div class="col-sm-8">
                    <select name="payableType" th:field="*{payableType}" class="form-control" th:with="type=${@dict.getType('payable_type')}" required>
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">付款类目：</label>
                <div class="col-sm-8">
                    <select name="payableCategory" class="form-control" th:field="*{payableCategory}" th:with="type=${@dict.getType('payable_category')}" required>
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">第几笔付款：</label>
                <div class="col-sm-8">
                    <select name="planNumber" class="form-control" th:field="*{planNumber}" th:with="type=${@dict.getType('account_number')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:selected="${dictVlue == '1000'}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">负责人：</label>
                <div class="col-sm-8">
                    <select name="manager"  class="form-control m-b" th:field="*{manager}" required th:with="type=${@customDictService.selectUserList()}">
                        <option value="0">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.userName}" th:value="${dict.userId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="description" class="form-control">[[*{description}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/payable/plan";
        $("#form-plan-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-plan-edit').serialize());
            }
        }

        $("input[name='expectTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>